#include <lib/string.h>

void *memcpy(void *dest, const void *src, size_t n)
{
	char *d, *s;
	
	d = (char *)dest;
	s = (char *)src;
	for(; n; n--)
		*d++ = *s++;
		
	return dest;
}

int memcmp(const void *s1, const void *s2, size_t n)
{
	const char *us1 = s1;
	const char *us2 = s2;
	while (n--)
	{
		if (*us1 < *us2)
			return -1;
		else if (*us1 > *us2)
			return 1;
		us1++;
		us2++;
	}
	return 0;
}

void *memset(void *s, const int c, size_t n)
{
	char *us = s;
	char uc = c;
	while (n--)
		 *us++ = uc;

	return s;
}

